package com.bdqn.boot.yuanshen.service.impl;

import com.bdqn.boot.yuanshen.bean.Notifications;
import com.bdqn.boot.yuanshen.mapper.NotificationsMapper;
import com.bdqn.boot.yuanshen.service.NotificationsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author 周宏锦
 * @Description 消息通知的业务逻辑层接口的实现
 * @Date 2025/3/19 15:01
 * @Version 1.0
 */
@Service
public class NotificationsServiceImpl implements NotificationsService {
    private NotificationsMapper notificationsMapper;
    /**
     * 添加消息通知数据
     * @param notifications 消息通知表的实体类
     * @return 返回受影响的行数
     */
    @Override
    public int addNotifications(Notifications notifications) {
        return notificationsMapper.addNotifications(notifications);
    }
    /**
     * 删除消息通知数据
     * @param id 删除编号
     * @return 返回受影响的行数
     */
    @Override
    public int delNotifications(Integer id) {
        return notificationsMapper.delNotifications(id);
    }


    /**
     * 多条件分页查询消息通知列表
     * @param map 多条件集合列表
     * @param pageNum 页码
     * @param pageSize 每页数量
     * @return 分页查询列表
     */
    @Override
    public PageInfo<Notifications> getNotificationsList(Map<String, Notifications> map,int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Notifications> notificationsList = notificationsMapper.getNotificationsList(map);
        return new PageInfo<>(notificationsList);
    }
}
